package com.ruoyi.dgdData.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.dgdData.domain.plat.DataDgdKdshj;
import com.ruoyi.dgdData.service.IDataDgdKdshjService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 单轨吊空动时间测试Controller
 * 
 * @author ruoyi
 * @date 2023-12-28
 */
@RestController
@RequestMapping("/dgd/kdshj")
@Api(value="单轨吊测试",tags = "单轨吊空动时间测试接口")
public class DataDgdKdshjController extends BaseController
{
    @Autowired
    private IDataDgdKdshjService dataDgdKdshjService;

    /**
     * 查询单轨吊空动时间测试列表
     */
    @PreAuthorize("@ss.hasPermi('dgd:kdshj:list')")
    @GetMapping("/list")
    @ApiOperation(value="查询单轨吊空动时间测试列表")
    public TableDataInfo list(DataDgdKdshj dataDgdKdshj)
    {
        startPage();
        List<DataDgdKdshj> list = dataDgdKdshjService.selectDataDgdKdshjList(dataDgdKdshj);
        return getDataTable(list);
    }

    /**
     * 导出单轨吊空动时间测试列表
     */
    @PreAuthorize("@ss.hasPermi('dgd:kdshj:export')")
    @Log(title = "单轨吊空动时间测试", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DataDgdKdshj dataDgdKdshj)
    {
        List<DataDgdKdshj> list = dataDgdKdshjService.selectDataDgdKdshjList(dataDgdKdshj);
        ExcelUtil<DataDgdKdshj> util = new ExcelUtil<DataDgdKdshj>(DataDgdKdshj.class);
        util.exportExcel(response, list, "单轨吊空动时间测试数据");
    }

    /**
     * 获取单轨吊空动时间测试详细信息
     */
    @PreAuthorize("@ss.hasPermi('dgd:kdshj:query')")
    @GetMapping(value = "/{kdshjId}")
    public AjaxResult getInfo(@PathVariable("kdshjId") Long kdshjId)
    {
        return success(dataDgdKdshjService.selectDataDgdKdshjByKdshjId(kdshjId));
    }

    /**
     * 新增单轨吊空动时间测试
     */
    @PreAuthorize("@ss.hasPermi('dgd:kdshj:add')")
    @Log(title = "单轨吊空动时间测试", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DataDgdKdshj dataDgdKdshj)
    {
        return toAjax(dataDgdKdshjService.insertDataDgdKdshj(dataDgdKdshj));
    }

    /**
     * 修改单轨吊空动时间测试
     */
    @PreAuthorize("@ss.hasPermi('dgd:kdshj:edit')")
    @Log(title = "单轨吊空动时间测试", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DataDgdKdshj dataDgdKdshj)
    {
        return toAjax(dataDgdKdshjService.updateDataDgdKdshj(dataDgdKdshj));
    }

    /**
     * 修改单轨吊空动时间测试
     */
    @PreAuthorize("@ss.hasPermi('dgd:kdshj:edit')")
    @Log(title = "单轨吊空动时间测试", businessType = BusinessType.UPDATE)
    @PutMapping("/editKdshj/{kdshjId}")
    @ApiOperation(value="修改单轨吊空动时间测试")
    public AjaxResult editKdshj(@PathVariable Long kdshjId)
    {
        return toAjax(dataDgdKdshjService.updateDataDgdKdshjByKdshjId(kdshjId));
    }

    /**
     * 删除单轨吊空动时间测试
     */
    @PreAuthorize("@ss.hasPermi('dgd:kdshj:remove')")
    @Log(title = "单轨吊空动时间测试", businessType = BusinessType.DELETE)
	@DeleteMapping("/{kdshjIds}")
    public AjaxResult remove(@PathVariable Long[] kdshjIds)
    {
        return toAjax(dataDgdKdshjService.deleteDataDgdKdshjByKdshjIds(kdshjIds));
    }
}
